package com.lz.service;

import com.lz.dao.UserDao;
import com.lz.entity.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.transaction.Transactional;

@Service
public class UserService {
    @Resource
    private UserDao userDao;

    @Transactional
    public void save(User user){
        userDao.save(user);
    }

    public User update(Long id){
        User user=userDao.findOne(id);
        user.setName("toy12");
        user=userDao.save(user);
        return user;
    }

}
